package exam;

import java.util.Scanner;
public class ChinaSystem {
    public static void main (String[] args) {
        // 完成主程序
        LinkQueue linkQueue = new LinkQueue();
        Scanner in = new Scanner(System.in);
        while(in.hasNextLong()){
            Long  num = in.nextLong();
            Long index = linkQueue.push(num);
            System.out.print(index);
            System.out.print(" ");
        }
    }
}

class LinkQueue {
    private QNode front; //队头指针
    //进队
    public Long push(Long num) {
        // 实现push方法

        if(front==null){
            this.front = new QNode(num);
            return 0L;
        }
        Long index = 0L;
        QNode i = front;
        while(i.next!=null&&i.next.getData()<num){
            i = i.next;
            index++;
        }
        QNode intsertNode = new QNode(num);
        if(i==front&&i.getData()>num){
            intsertNode.next=front;
            front = intsertNode;
            return 0L;
        }else{
            QNode temp = i.next;
            i.next = intsertNode;
            intsertNode = temp;
        }
        return index+1;
    }
}

//链队结点
class QNode {
    private Long data;//数据域
    public QNode next;//指针域

    //初始化1
    public QNode() {
        this.data = null;
        this.next = null;
    }

    //初始化2
    public QNode(Long data) {
        this.data = data;
        this.next = null;
    }

    public Long getData() {
        return data;
    }

    public void setData(Long data) {
        this.data = data;
    }
}
